Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

texlive_latest: init at 2023.20230606 #236382

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

apfelkuchen6
Copy link
Contributor

Description of changes

This is an alternative approach to #222142 suggested by @xworld21 in #222142 (comment): This adds texlive-2023 in addition to the old version instead of replacing it.

I also noticed the following:

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@github-actions github-actions bot added the 6.topic: TeX Issues regarding texlive and TeX in general label Jun 7, 2023
@ofborg ofborg bot added the 8.has: package (new) This PR adds a new package label Jun 7, 2023
@ofborg ofborg bot requested a review from veprbl June 7, 2023 03:09
@veprbl veprbl requested a review from xworld21 June 7, 2023 03:40
Copy link
Contributor

@drupol drupol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just added a few comments while passing by :)

@apfelkuchen6 apfelkuchen6 force-pushed the nixpkgs-multi-version branch from 32fcec8 to 4f07992 Compare June 7, 2023 14:13
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How hard would it be to have bin.nix as before, and an extra bin-latest.nix with overrides only? Which I believe would be the more nixpkgs-y way of providing two versions.

Alternatively, bin-latest.nix could be a straight copy of bin.nix, which would become the new bin.nix once it becomes frozen.

Copy link
Contributor Author

@apfelkuchen6 apfelkuchen6 Jun 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly as before is rather inconvenient as the sources would have to be overridden for every derivation. Just passing in the source as an argument and doing the patches and version-specific hacks via overrides shouldn't be too hard at this time as 2023 mostly just adds hacks over 2022. This might become more inconvenient if parts of hacks have to be removed.

I don't really like either approach. Using overrides makes upgrading less convenient and having a complete copy of the file feels really wasteful. I think just keeping bin.nix mostly general and put version-specific hacks/patches somewhere else for both versions is better as the upgrade remains just moving a file.

@@ -317,23 +317,29 @@ in (buildEnv {
''
rm "$out"/bin/*-sys
wrapBin
'' +
''
+ bin.cleanBrokenLinks +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Incidental: cleanBrokenLinks will disappear with the bin container patch. I believe it is already a no-op since we started using texlinks.)

substitute "$TEXMFDIST"/scripts/context/lua/mtxrun.lua mtxrun.lua \
--replace 'cache_uuid=osuuid()' 'cache_uuid="e2402e51-133d-4c73-a278-006ea4ed734f"' \
--replace 'uuid=osuuid(),' 'uuid="242be807-d17e-4792-8e39-aa93326fc871",'
FORCE_SOURCE_DATE=1 TZ= faketime -f '@1980-01-01 00:00:00 x0.001' luatex --luaonly mtxrun.lua --generate

if [[ -e "$out/bin/luametatex" ]]; then
# we intentionally don't use the scripts.lst-mechanism here since we don't want to strip the suffix or wrap the scripts here.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This should also become unnecessary after the bin container patch.)

@@ -5003,7 +5005,8 @@ with pkgs;
texFunctions = callPackage ../tools/typesetting/tex/nix pkgs;

# TeX Live; see https://nixos.org/nixpkgs/manual/#sec-language-texlive
texlive = recurseIntoAttrs (callPackage ../tools/typesetting/tex/texlive { });
texlive = recurseIntoAttrs (callPackage ../tools/typesetting/tex/texlive/frozen.nix { });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Picking up on the above, I believe tradition is to use default.nix for the stable version (thus default.nix -> make-tex-live.nix and frozen.nix -> default.nix).

Copy link
Contributor Author

@apfelkuchen6 apfelkuchen6 Jun 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There already are a lot of files here and I feel like this makes it even less obvious where what is as this breaks up the symmetry between the two versions and replaces default.nix with a mostly empty file just containing version information. How do you feel about the following layout:

├── bin.nix
├── combine.nix
├── generate-fixed-hashes.nix
├── latest
│   ├── default.nix
│   ├── fixed-hashes.nix
│   ├── tlpdb.nix
├── make-texlive.nix
├── make-texlive-packages.nix
├── stable
│   ├── default.nix
│   ├── fixed-hashes.nix
│   ├── tlpdb.nix
├── tl2nix.sed
└── UPGRADING.md

Version specific stuff is put into subdirectories whereas make-texlive.nix becomes a generic function that builds the texlive(_latest) scope. The code that builds the texlive packages (currently tl in default.nix) is extracted into a separate file make-texlive-packages.

The entry points called in all-packages.nix are moved into the subdirectories and call make-texlive.nix, with the version-specific stuff, possibly applying overrides.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@apfelkuchen6 now that the binary containers are in, what do you think of refactoring the packages in texlivePackages? Presumably with tlpdb.nix and fixed-hashes.nix in a separate texlive-packages/ folder, while texlive keeps the combine machinery in place. The Nix expressions to build the packages should probably stay under texlive, e.g. texlive.buildPackage. Priority should be to make the entire thing easy to override, something which is currently very hard.

You have a few pieces here already – shall we start from those? Say with a new 0-rebuild PR?

callPackage ./default.nix {
inherit version tlpdb tlpdbxz fixedHashes urlPrefixes src;
texlive = texlive_latest;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E.g. could the 2023-specific overrides happen here? Likewise 2022-only patches could be specified in frozen.nix.

Copy link
Contributor

@xworld21 xworld21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's very good. I thought it would be a lot harder.

I like that frozen.nix and latest.nix more or less contain the essential information about each specific version. However, the logic is still duplicated around – default.nix has special code for 2022 and 2023; the urls can be computed once in default.nix, like before; and similar (see comments).

I suggest we push further, and have a make-tex-live.nix that takes as input: the version info, the tlpdb.xz hash (just the hash, not the url!), tlpdb.nix, the binary sources, and fixed hashes. Then frozen.nix calls that function and plugs in whatever overrides are required (e.g. version-specific patches).

@apfelkuchen6 apfelkuchen6 force-pushed the nixpkgs-multi-version branch from 4f07992 to f52763b Compare June 13, 2023 20:40
@apfelkuchen6 apfelkuchen6 marked this pull request as draft June 19, 2023 22:41
apfelkuchen6 and others added 10 commits August 21, 2023 22:41
This prepares the use of callPackage (to avoid repeating the parameter names all
over the place) and makes static analysis possible
The assertion that all TeX Live packages have a fixed hash is time
consuming and should only be checked when running tests.
this is purely a whitespace change that was separated from the previous commit
to make the diff easier to read
This generic interface allows the addition of texlive-2023 without repeating too
much code or case distinctions

TODO: rename default.nix -> generic.nix, stable.nix -> default.nix
This will be done later as this makes rebasing a lot harder
@apfelkuchen6 apfelkuchen6 force-pushed the nixpkgs-multi-version branch from 70053c0 to ea56a00 Compare August 21, 2023 20:54
@chaoflow chaoflow mentioned this pull request Sep 20, 2023
12 tasks
@wegank wegank added 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 2.status: merge conflict This PR has merge conflicts with the target branch labels Mar 19, 2024
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Mar 20, 2024
@wegank wegank added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: merge conflict This PR has merge conflicts with the target branch 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: TeX Issues regarding texlive and TeX in general 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 101-500 10.rebuild-linux: 101-500
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants